from rest_framework.serializers import SerializerMethodField,ModelSerializer
from .models import *
class ClassifySer(ModelSerializer):
    class Meta:
         model = Classify
         fields = '__all__'
class BooksSer(ModelSerializer):
    cate_name = SerializerMethodField(read_only=True)
    def get_cate_name(self,obj):
        return obj.cate.name
    class Meta:
        model = Books
        fields = '__all__'
